package com.demo.service.impl;

import com.demo.dao.AccountDao;
import com.demo.pojo.Account;
import com.demo.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @ClassName AccountServiceImpl
 * @Description TODO
 * @Author Windy
 * @Date 2022/9/4 20:14
 * @Version 1.0
 **/
@Service
@Transactional
public class AccountServiceImpl implements AccountService {
    @Autowired
    AccountDao accountDao;
    @Override
    public List<Account> findAll() {
        System.out.println("service....");
        return accountDao.findAll();
    }

    @Override
    public Account findOneById(int id) {
        return accountDao.findOneById(id);
    }

    @Override
    public boolean updateACCount(Account account) {
        boolean b = accountDao.updateACCount(account) >= 0;
        int i=1/0;
        return b;
    }

    @Override
    public boolean deleteAccount(int id) {
        return accountDao.deleteAccount(id) >= 0;
    }

    @Override
    public boolean insertAccount(Account account) {
        return accountDao.insertAccount(account) >= 0;
    }


}
